package main

import (
	"github.com/bitly/go-simplejson"
	"fmt"
)

func main() {
	// str1 := `{"error":{"status":202,"code":400,"description":"The request body can’t be pasred as valid data."}}`
	body := `{
  "version": {
      "max": 3,
      "last": "2016-03-11",
      "detail": [
          {
              "time": "2016-03-12",
              "ops": "add my email"
          }
         ]
      }
  }
  `

	js, err := simplejson.NewJson([]byte(body)) //反序列化
	if err != nil {
		panic(err.Error())
	}
	a, _ :=js.Get("version").Get("max").Int()
	fmt.Println(a)

	fmt.Println(js.Get("version").Get("detail").GetIndex(0))

	b,_:=js.Get("version").Get("detail").GetIndex(0).Get("ops").String()
	fmt.Println(b)

}